package org.cloud.im.core.session.id.impl;

import org.cloud.im.core.http.HttpConfig;
import org.cloud.im.core.session.id.ISessionIdGenerator;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.UUID;

/**
 * @Author: w.weidong.lin@abite.com
 * @Description: TODO
 * @Date: create in 2021/10/19 15:12
 */
public class UUIDSessionIdGenerator implements ISessionIdGenerator {
    private static Logger log = LoggerFactory.getLogger(UUIDSessionIdGenerator.class);

    public final static UUIDSessionIdGenerator instance = new UUIDSessionIdGenerator();

    /**
     * @param args
     * @author wchao
     */
    public static void main(String[] args) {
        UUIDSessionIdGenerator uuidSessionIdGenerator = new UUIDSessionIdGenerator();
        String xx = uuidSessionIdGenerator.sessionId(null);
        log.info(xx);

    }

    /**
     * @author wchao
     */
    private UUIDSessionIdGenerator() {
    }

    /**
     * @return
     * @author wchao
     */
    @Override
    public String sessionId(HttpConfig httpConfig) {
        return UUID.randomUUID().toString().replace("-", "");
    }
}
